#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :2.0.1 简单的多任务演示.py
# @Time      :2020/7/13 10:24
# @Author    :亮亮
# @说明       :简单介绍大多任务原理
# @总结       :
import time
import threading


def sing():
    for i in range(5):
        print("----正在唱歌{}----".format(i))
        time.sleep(1)


def dance():
    for i in range(5):
        print("----正在跳舞{}----".format(i))
        time.sleep(1)


def main():
    t1 = threading.Thread(target=sing)
    t2 = threading.Thread(target=dance)
    t1.start()  # 启动线程
    t2.start()

    while True:

        print(threading.enumerate())
        if len(threading.enumerate()) <= 1:
            break
        time.sleep(1)


if __name__ == '__main__':
    main()
